<template>
    <div>
        <Dimension v-for="(item, index) in dimensions" :key="index" v-bind:dimensions="dimensions" v-bind:virtual="virtual" v-bind:properties="properties" v-bind:index="index"></Dimension>
        <a-button v-if="dimensions.length === 0" v-on:click="addItem()">添加维度</a-button>
    </div>
</template>

<script>
    import Dimension from "./Dimension";
    export default {
        name: "DimensionGroup",
        components: {Dimension},
        props: {
            properties: Array,
            dimensions: Array,
            virtual: {
                type: Boolean,
                default: false
            }
        },
        // provide: function() {
        //     return {
        //         dimensions: this.dimensions
        //     }
        // },
        data: function() {
            return {
                // dimensions: []
            }

        },
        methods: {
            addItem: function() {
                this.dimensions.push(this.properties[0].name);
            }
        }
    }
</script>

<style scoped>

</style>